<?php
class Config_Model extends Model {
    private $config = null;
    function load() {
        $stmt = $this -> db -> query( 'SELECT * FROM config' );
        while( $r = $stmt -> fetch( PDO::FETCH_OBJ ) ) {
            $this -> config[ $r -> name ] = $r -> value;
        }
        $stmt -> closeCursor();
        return $this -> config;
    }
    function get( $key ) {
        if( $this -> config === null )
            $this -> load();
        return isset( $this -> config[ $key ] ) ? $this -> config[ $key ] : false;
    }
    function getScripts() {
        $scripts = explode( ',', $this -> get( 'scripts' ) );
        return $scripts;
    }
}